<div class="testpaper-question testpaper-question-choice {% if setting('magic.testpaper_watermark') %}testpaper-watermark{% endif %}" data-watermark-url="{{ path('cloud_testpaper_watermark') }}" id="question{{ item.questionId }}">

	{% set keys = [] %}
	{% set keys_answer = [] %}
	<div class="testpaper-question-body">
    {% include 'TopxiaWebBundle:QuizQuestionTest:testpaper-question-stem.html.twig' %}

		<ul class="testpaper-question-choices">
			{% for key, choice in item.question.metas.choices %}
			  {% set itemClass =  ((paperResult.status|default(null) in ['reviewing', 'finished']) and (key in item.question.answer)) ? 'testpaper-question-choice-right' : '' %}
			  {% set choiceIndex = (65+key)|chr %}

				<li class="{{ itemClass }}"><span class="testpaper-question-choice-index">{{ choiceIndex }}.</span> {{ choice|bbCode2Html|raw }}</li>
				{% if key in item.question.answer %}
					{% set keys = keys|merge([choiceIndex]) %}
				{% endif  %}
				{% if key in item.question.testResult.answer|default([]) %}
					{% set keys_answer = keys_answer|merge([choiceIndex]) %}
				{% endif %}
			{% endfor %}
		</ul>
	</div>
	{% if (paperResult.status|default(null) in ['reviewing', 'finished'] and setting('questions.testpaper_answers_show_mode','submitted') == 'submitted') or (setting('questions.testpaper_answers_show_mode','submitted') == 'reviewed'  and paperResult.status|default(null) == 'finished') %}
		<div class="testpaper-question-footer clearfix">
		  <div class="testpaper-question-result">
				{% if item.question.testResult.status == 'right' %}
					{{'正确答案是'|trans}} <strong class="text-success">{{ keys|join(',') }}</strong>，{{'回答正确'|trans}}
				{% elseif item.question.testResult.status == 'partRight' %}
					{{'正确答案是'|trans}} <strong class="text-success">{{ keys|join(',') }}</strong>，{{'你的答案是'|trans}} <strong class="text-danger">{{ keys_answer|join(',') }}</strong>{{'。回答部分正确。得分：%testResult.score%分'|trans({'%testResult.score%': item.question.testResult.score})}}
				{% elseif item.question.testResult.status == 'wrong' %}
					{{'正确答案是'|trans}} <strong class="text-success">{{ keys|join(',') }}</strong>，{{'你的答案是'|trans}} <strong class="text-danger">{{ keys_answer|join(',') }}</strong>。{{'回答错误'|trans}}
				{% elseif item.question.testResult.status == 'noAnswer' %}
				  {{'正确答案是'|trans}} <strong class="text-success">{{ keys|join(',') }}</strong>，{{'你未答题'|trans}}
				{% endif %}
		  </div>

			<div class="testpaper-question-actions pull-right">
				{% include 'TopxiaWebBundle:QuizQuestionTest:flag.html.twig' with { flags:['favorite', 'analysis'] } %}
			</div>

		</div>
		<div class="testpaper-question-analysis well" style="display:none;">
			{{ item.question.analysis|bbCode2Html|raw|nl2br }}
			{% include 'TopxiaWebBundle:Attachment/Widget:list.html.twig' with {targetType:'question.analysis', targetId:item.question.id  } %}
		</div>
	{% else %}
		<div class="testpaper-question-footer clearfix">

		  <div class="testpaper-question-choice-inputs">
				{% for key, choice in item.question.metas.choices %}
					{% set choiceIndex = (65+key)|chr %}

					<label class="{% if item.questionType == 'single_choice' %}radio{% else %}checkbox{% endif %}-inline {% if choiceIndex in keys_answer %}active{% endif %}">
						<input type="{% if item.questionType == 'single_choice' %}radio{% else %}checkbox{% endif %}" data-type="choice" name="{{ item.questionId }}" value="{{ key }}" {% if choiceIndex in keys_answer %}checked{% endif %} >
						{{ choiceIndex }}
					</label>
				{% endfor %}
		  </div>

		  <div class="testpaper-question-actions pull-right">
				{% include 'TopxiaWebBundle:QuizQuestionTest:flag.html.twig' with { flags:['mark', 'favorite'],resultStatus:paperResult.status|default(null) } %}
		  </div>
		</div>

		{% if questionPreview|default(false) %}
		  <div class="testpaper-preview-answer clearfix mtl mbl">
		  	<div class="testpaper-question-result">
				{{'正确答案是'|trans}} <strong class="text-success">{{ keys|join(',') }}</strong>
		  	</div>
		  </div>

		  <div class="testpaper-question-analysis well">
		  	{{ item.question.analysis|default('无解析'|trans)|bbCode2Html|raw|nl2br }}
	    	{% include 'TopxiaWebBundle:Attachment/Widget:list.html.twig' with {targetType:'question.analysis', targetId:item.question.id  } %}
		  </div>
		{% endif %}


	{% endif %}
</div>